package com.smt.ejb3.tutoria.callback.insideentity;

import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.ejb.PostActivate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.PostPersist;
import javax.persistence.PrePersist;

@Entity
public class Apple implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private int id;
	
	private String name;

	@Id
	@Column(name="APPLE_ID")
	@GeneratedValue(strategy=GenerationType.AUTO)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(name="APPLE_NAME")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@PrePersist
	public void preSave(){
		System.out.println("Pre persist method is called");
	}
	
	@PostPersist
	public void postSave(){
		System.out.println("Post persist method is called");
	}
	
	@PostConstruct
	public void postConstruct(){
		System.out.println("Post Construct method is called");
	}
	
	@PreDestroy
	public void preDestroy(){
		System.out.println("Pre Destroy method is called");
	}
	
}